package com.housekeeping.housekeeping.administrator.adminsclassify.service.impl;

import com.housekeeping.housekeeping.administrator.adminsclassify.dao.ClassifyDao;
import com.housekeeping.housekeeping.administrator.adminsclassify.dao.impl.ClassifyDaoImpl;
import com.housekeeping.housekeeping.administrator.adminsclassify.service.ClassifyService;
import com.housekeeping.housekeeping.administrator.entity.AdminsClassify;
import com.housekeeping.housekeeping.administrator.utils.Page;

import java.sql.SQLException;
import java.util.List;

public class ClassifyServiceImpl implements ClassifyService {
    private ClassifyDao classifyDao=new ClassifyDaoImpl();
    @Override
    public Page<AdminsClassify> list(int page, int size) throws SQLException {
        List<AdminsClassify> list = classifyDao.Query((page - 1) * size, size);

        int count = classifyDao.selectCount();
        Page<AdminsClassify> pageBean = new Page<>(page, size, count);
        pageBean.setData(list);
        return pageBean;
    }

    @Override
    public int delete(int id) {
       return classifyDao.delete(id);
    }
}
